import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

import index from '../components/index.vue'
import register from '../components/register.vue'
import login from '../components/login.vue'
import shopsgood from '../components/shopsgood.vue'
import address from '../components/address.vue'
import shopsreg from '../components/shopsreg.vue'
import shopslogin from '../components/shopslogin.vue'
import shopsindex from '../components/shopsindex.vue'
import usersinfo from '../components/usersinfo.vue'
import shopslist from '../components/shopslist.vue'
import shopsinfo from '../components/shopsinfo.vue'
import goodtype from '../components/goodtype.vue'
import good from '../components/good.vue'
import collect from '../components/collect.vue'
import order from '../components/order.vue'
import ordershow from '../components/order_show.vue'
import ordernot from '../components/order_not.vue'
import orderpay from '../components/order_pay.vue'
import goodstype from '../components/goodstype.vue'
import comment from '../components/comment.vue'

var routes = [
  {
    path: '/index',
    name: 'index',
    component: index,
    children:[
      {
        path: 'usersinfo',
        name: 'usersinfo',
        component: usersinfo
      },
      {
        path: 'shopslist',
        name: 'shopslist',
        component: shopslist
      },
      {
        path: 'order',
        name: 'order',
        component: order
      },
      {
        path: 'goodstype',
        name: 'goodstype',
        component: goodstype
      },
    ]
  },
  {
    path: '/register',
    name: 'register',
    component: register
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/shopsgood',
    name: 'shopsgood',
    component: shopsgood
  },
  {
    path: '/address',
    name: 'address',
    component: address
  },
  {
    path: '/shopsreg',
    name: 'shopsreg',
    component: shopsreg
  },
  {
    path: '/shopslogin',
    name: 'shopslogin',
    component: shopslogin
  },
  {
    path: '/ordershow',
    name: 'ordershow',
    component: ordershow
  },
  {
    path: '/ordernot',
    name: 'ordernot',
    component: ordernot
  },
  {
    path: '/orderpay',
    name: 'orderpay',
    component: orderpay
  },
  {
    path: '/comment',
    name: 'comment',
    component: comment
  },
  {
    path: '/shopsindex',
    name: 'shopsindex',
    component: shopsindex,
    children:[
      {
        path: 'shopsinfo',
        name: 'shopsinfo',
        component: shopsinfo
      },
      {
        path: 'goodtype',
        name: 'goodtype',
        component: goodtype
      },
      {
        path: 'good',
        name: 'good',
        component: good
      },
    ]
  },
  {
    path: '/collect',
    name: 'collect',
    component: collect,
  },
]


const router = new createRouter({
  history: createWebHistory(), // history为必填项
  //history:createWebHashHistory(),
  routes,
})

export {
  router
}
